{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/mmgrid/mmGrid.css?v={$v}" />
<style>
body{overflow:hidden;}
</style>
{/block}
{block name="js"}
<script src="__STATIC__/plugins/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/templatemsgs/templatemsgs.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<div class="layui-tab layui-tab-brief " lay-filter="msgTab">
	<ul class="layui-tab-title">
	  <li {if condition="$src==0"}class="layui-this"{/if} onclick="initGridMsg(0)">消息模板</li>
	  <li {if condition="$src==1"}class="layui-this"{/if} onclick="initGridEmail(0)">邮件模板</li>
	  <li {if condition="$src==2"}class="layui-this"{/if} onclick="initGridSMS(0)">短信模板</li>
	</ul>
	<div class="layui-tab-content " style="padding: 0px 0;">
	 	<div id="template_msg" class="layui-tab-item {if condition='$src==0'}layui-show{/if}">
           <div class='wst-grid' style='margin-top:5px'>
			<div id="mmg1" class="mmg1 layui-form"></div>
			<div id="pg1" style="text-align: right;"></div>
		  </div>
        </div>
	 	<div id="template_email" class="layui-tab-item {if condition='$src==1'}layui-show{/if}">
           <div class='wst-grid' style='margin-top:5px'>
			<div id="mmg2" class="mmg2 layui-form"></div>
			<div id="pg2" style="text-align: right;"></div>
		  </div>
        </div>
	 	<div id="template_sms" class="layui-tab-item {if condition='$src==2'}layui-show{/if}">
	 	   <div id='alertTips' class='alert alert-success alert-tips fade in'>
		   <div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
		   <ul class='body'>
		    <li>本功能主要用于管理短信发送的模板格式。</li>
		    <li>若短信服务商未要求预先定义模板，则发送时以本系统模板为主（例如中国网建）。</li>
		    <li>若短信服务商要求必须预先定义模板的(例如阿里云-云通信)，则本系统中的模板仅作为建模参考，发送格式以短信服务商上的模板为主。</li>
		   </ul>
		  </div>
		  <div class='wst-grid'>
			<div id="mmg3" class="mmg3 layui-form"></div>
			<div id="pg3" style="text-align: right;"></div>
		  </div>
        </div>
    </div>
</div>
<script>
	$(function(){
		h = WST.pageHeight();
		{if condition='$src==1'}
			initGridEmail({$p});
		{elseif condition='$src==2'}
			initGridSMS({$p});
		{else/}
			initGridMsg({$p});
		{/if}
            var isInit1 = false;
            var isInit2 = false;
            var isInit3 = false;
            var element = layui.element;
            element.on('tab(msgTab)', function(data){
                if(data.index==0){
                    if(!isInit1){
                        isInit1 = true;
                        initGridMsg({$p});
                    }
                }else if(data.index==1){
                    if(!isInit2){
                        isInit2 = true;
                        initGridEmail({$p});
                    }
                }else if(data.index==2){
                    if(!isInit3){
                        isInit3 = true;
                        initGridSMS({$p});

                    }
                }
            });


	});
</script>
{/block}

